package com.cqggrw.action;

import com.cqggrw.domain.Ad;
import com.cqggrw.domain.Json;
import com.cqggrw.service.AdServiceI;
import com.cqggrw.service.impl.AdServiceImpl;
import com.opensymphony.xwork2.ModelDriven;

public class AdAction extends BaseAction implements ModelDriven<Ad> {

	private static final long serialVersionUID = 1L;
	private AdServiceI service = new AdServiceImpl();
	public Ad ad = new Ad();
	
	public void get() {
		super.writeJson(service.get());
	}
	
	public void modify() {
		Json json = new Json();
		if (service.modify(ad, super.getProjectPath())) {
			json.setSuccess(true);
			json.setMsg("修改成功!");
		} else {
			json.setSuccess(false);
			json.setMsg("修改失败!");
		}

		super.writeJson(json);
	}

	public Ad getModel() {
		return ad;
	}

}
